<?php
session_start();
include_once("../inc/conn.php");
include_once("../inc/get_attitude.php");
include_once("../inc/escape.php") ; 

$joke_id=str_replace("\"","'",trim($_POST["joke_id"]));
$level=str_replace("\"","'",trim($_POST["level"]));

$account_name=$_SESSION["account_name"];

$result = mysql_query("select * from joke where id='".$joke_id."'");
$row = mysql_fetch_array($result);
$author_name=$row["author"];

$sql="insert into attitude(joke_id,account_name,level) VALUES ";
$sql=$sql ."('". $joke_id   ."',";
$sql=$sql . "'". $account_name     ."',";
$sql=$sql . "'". $level     ."')";

mysql_query($sql);



mysql_query("update account set award=award+".(3-$level).",money=money+".(3-$level)." where name='".$author_name."'");

echo "1";

?>
